#ifndef OPTEXT
#define OPTEXT


#include "VMPFocus.hpp"
#include "operations.hpp"
//Operation Text:
//Formula:
//"([^\"]|\")*"

//helper:

cText TEXT_TEXT="text";

void funOpTextPostL(ListIdentity* what){
	int i=0;
	for (; i<lsOperations.length(); ++i)
		if (lsOperations[i]==Operations[TEXT_TEXT])
			break;
	lsOperations.erase(lsOperations.begin()+i);
};

//PreLining:

//PostLining:

//MkTree:
//====Should add Transchar function.
ptrParsedElement funOpTextMkTree(ptrText code, ptrIdentity identity, ptrParsedElement PE){
	PE->Extended=(void*)(new cText(*code,identity->Range.begin+1,identity->Range.end-identity->Range.begin-1));
	return PE;
};
//Evaluate:
sRecord funOpTextEva(ptrRETNode retnode, ptrParsedElement pe, void* scope){
	return CreateTextDough((ptrText)(pe->Extended));
}


ptrOperation loadOpText(){
	ptrOperation tmp=new cOperation();
	tmp->Formula="\"([^\"]|\\\\\")*\"";
	tmp->Name=TEXT_TEXT;
	tmp->onEvaluate=funOpTextEva;
	tmp->onPreLining=NULL;
	tmp->onPostLining=funOpTextPostL;
	tmp->onMakingTree=funOpTextMkTree;
	return tmp;
}

#endif